package collect.taobao.util;
///**        * ��ݿⱸ��ʵ�ַ���        *         *         */  
//@Override   public String backupMysql() {  
//	//�����ļ����·��       String sql ="";     //��ݿ���� //��ȡXML�õ���ݿ����    String databaseName = "";      
//	//  ����URL    String address = "";        //  �����ļ����·��    String sqlpath = "";  
//	//��ȡXML�õ���ݿ��û����    String username = "";    //��ȡXML�õ���ݿ��û��������     String password = ""; 
//	//���ݷ����ַ    address = "localhost";     //��ݿ����·��    String url="";     
//	//��÷��񷢲��ľ��·��    String path = System.getProperty("user.dir");     path = path.substring(0,path.lastIndexOf(��\\"))+"\\webapps\\BIMS\\";   
////��ȡapplicationDataSource.xml�ļ� ȡ�� ��ݿ���  
//	File f = new File(path+ "/WEB-INF/classes/configs/applicationDataSource.xml");  
//	SAXReader reader = new SAXReader();    Document doc = null;   
//	try {  
//		doc = reader.read(f);    
//	} catch (DocumentException e1) {     
//		log.debug(e1.getMessage());    } 
//	//�������node�ڵ㼯��     Node node = doc.selectSingleNode("//*[@name='url']");     
//	Element e = (Element)node;          url=e.attributeValue("value");                   
//	node = doc.selectSingleNode("//*[@name='username']");       
//	e = (Element)node;    
//	username=e.attributeValue("value");        
//	node = doc.selectSingleNode("//*[@name='password']");     
//	e = (Element)node;          password=e.attributeValue("value");         
//	// �õ�MYSQL���û����������� mysql �� cmd:    String[] realp=path.split(":");   
//	//�����ļ����·�� Ŀ¼���Լ�����д    sql = realp[0]+":"+"\\MySQlBimsBuckup\\";   
//	String[] urls=url.split("/");    //��ݿ����     databaseName = urls[urls.length-1];      
//	//�����ļ����·��       sqlpath = sql;        address = "localhost";   
//	//�ļ�·��    File backupath = new File(sqlpath);     if (!backupath.exists()) {  
//	backupath.mkdir();   
//	}   
//String time = StringUtil.dateToStr(new Date(), "yyyy-MM-dd");   
//	String filename = time + ".sql";    StringBuffer sb = new StringBuffer();  
//	//ƴ������    sb.append("mysqldump ");    sb.append("--opt ");    sb.append("-h ");    sb.append(address);    sb.append(" ");    sb.append("--user=");    sb.append(username); 
//	sb.append(" ");   
//	sb.append("--password=");    
//	sb.append(password);  
//	sb.append(" ");   
//	sb.append("--lock-all-tables=true "); 
//	sb.append("--result-file=");   
//	sb.append(sqlpath); 
//	sb.append(filename);    sb.append(" ");  
//	sb.append("--default-character-set=utf8 ");  
//	sb.append(databaseName);     Runtime cmd = Runtime.getRuntime();   
//	try {     Process p = cmd.exec("cmd /c " + sb.toString());    
//	InputStreamReader isr = new InputStreamReader(p.getInputStream());  
//	BufferedReader br = new BufferedReader(isr);  
//	FileOutputStream fos = new FileOutputStream(sqlpath + filename);  
//	OutputStreamWriter osw = new OutputStreamWriter(fos);   
//	BufferedWriter bw = new BufferedWriter(osw);     String line = null;    
//	while ((line = br.readLine()) != null) {     
//		bw.write(line);   
//		bw.flush();     }   
//	br.close(); 
//		bw.close();   
//		// System.out.println("�������" + sb.toString()); } catch (IOException e1)
//		// { log.debug("",e1);//û���� } return null; }
//}